package com.example.zhujiemian;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
public class LoginActivity extends AppCompatActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        Button button=(Button)findViewById(R.id.login_btn_forgetregister);
        button.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){new AlertDialog.Builder(LoginActivity.this).setTitle("系统提示").setMessage("请输入验证信息进行验证!")
                    .setPositiveButton("确定",new DialogInterface.OnClickListener(){
                        @Override
                        public void onClick(DialogInterface dialog,int which){
                            finish();
                        }
                    }).setNegativeButton("返回",new DialogInterface.OnClickListener(){
                        @Override
                        public void onClick(DialogInterface dialog,int which){
                        }

                    }).show();
            }
        });
        Button button1=(Button)findViewById(R.id.login_btn_login);
        button1.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                /*if判断数据库信息*/
                new AlertDialog.Builder(LoginActivity.this).setTitle("系统提示").setMessage("登录成功!")
                        .setNegativeButton("确定",new DialogInterface.OnClickListener(){
                            @Override
                            public void onClick(DialogInterface dialog,int which){
                            }
                        }).show();
                /*if判断是否成功*/
                Intent intent=new Intent(LoginActivity.this,MainInterface.class);
                startActivity(intent);
                /*不成功，提示密码错误*/
            }
        });
        Button button2=(Button) findViewById(R.id.login_btn_register);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
                startActivity(intent);
            }
        });
    }
}
